export default {
    props: {
        // exportTitle: {
        //     type: String,
        //     default: `导出周报-${new Date().format('yyyy-MM-dd hh-mm-ss')}-${new Date().getTime()}`
        // } //导出文件标题
    },
    data() {
        return {
            exportTable: {
                loading: false,
                rows: []
            }
        }
    },
    methods: {
        exportExcel() {
            this.exportTitle = this.exportTitle || `导出周报-${new Date().format('yyyy-MM-dd hh-mm-ss')}-${new Date().getTime()}`
            this.exportTable.loading = true
            // let parmars = {
            //     uid: this.uid, //测试时随意整数
            //     pageNo: this.pagination.pageNo,
            //     pageSize: this.pagination.pageSize
            // };
            this.workAPI().then(res => {
                // console.log(res)
                this.exportTable.loading = false
                this.$hideLoading()
                let tableData = res.building.weeklist;
                tableData = [...tableData, ...res.builded.weeklist];
                this.exportTable.rows = (tableData || []).map(r => this.columns.map(col => r[col.prop]))
                this.$nextTick(() => {
                    this.$refs.exportTable.export(this.exportTitle)
                })
            })
        }
    }
}